package com.hhit.bigscreenbackmanage.controller.jsgl;

import com.alibaba.fastjson.JSONObject;
import com.hhit.bigscreenbackmanage.common.Response;
import com.hhit.bigscreenbackmanage.entity.jsgl.TJsglCspsxm;
import com.hhit.bigscreenbackmanage.entity.jsgl.TJsglGljh;
import com.hhit.bigscreenbackmanage.entity.jsgl.TJsglSjzlwt;
import com.hhit.bigscreenbackmanage.service.jsgl.TJsglCspsxmService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/jsgl/cspsxm")
public class CspsxmController {

    private Logger log = LoggerFactory.getLogger(CspsxmController.class);

    @Autowired
    TJsglCspsxmService tJsglCspsxmService;

    /**
     * 查询新技术应用统计数据
     * @param jsonObject
     * @return
     */
    @RequestMapping("/queryXjsyjyyCount")
    public Response queryXjsyjyyCount(@RequestBody JSONObject jsonObject){
        try{
            Map<String,String> result = tJsglCspsxmService.queryXjsyjyyCount(jsonObject);
            return Response.createResponseBySuccess("查询新技术研究应用统计数据成功",result);
        }catch (Exception e){
            log.error("查询新技术研究应用统计数据失败: " + e.getMessage());
            e.printStackTrace();
            return Response.createResponseByError("查询新技术研究应用统计数据失败");
        }
    }

    /**
     * 查询 新技术研究应用
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getXjsyjyyList")
    public Response getXjsyjyyList(@RequestBody JSONObject jsonObject){
        try{
            Map<String, Object> result = tJsglCspsxmService.queryXjsyjyyList(jsonObject);
            return Response.createResponseBySuccess("查询新技术研究应用成功",result);
        }catch (Exception e){
            log.error("查询新技术研究应用失败: " + e.getMessage());
            e.printStackTrace();
            return Response.createResponseByError("查询新技术研究应用失败");
        }
    }

    /**
     * 删除 新技术研究应用记录
     * @param jsonObject
     * @return
     */
    @RequestMapping("/deleteXjsyjyyRecord")
    public Response deleteXjsyjyyRecord(@RequestBody JSONObject jsonObject){
        try{
            tJsglCspsxmService.deleteXjsyjyyRecord(jsonObject);
            return Response.createResponseBySuccess("删除新技术研究应用记录成功");
        }catch (Exception e){
            e.printStackTrace();
            return Response.createResponseByError("删除新技术研究应用记录失败: "+e.getMessage());
        }
    }
}
